<?php
$dir = dirname(dirname(__FILE__));
include_once 'Common.inc.php';

include($dir.'/__queue_global.php');

$host = 's6211i.apollo.grid.sina.com.cn:6211';
$port = '6211';
$user = 'elink';
$pw = 'elink2046';
$name = 'elink';
$table = 'ml_follow_';

$oBizAt = new ml_biz_atNick_followList();
for($a=0; $a<32; $a++){
    
$b = base_convert($a, 10, 16);
$b = str_pad($b, 2, "0", STR_PAD_LEFT);

$sql = 'select `uid`, `follow_uid` from `'.$table.$b.'` where `status`= 1';

$conn = mysql_connect($host.':'.$port , $user , $pw, true);
mysql_set_charset('utf-8' , $conn);
$re = mysql_select_db($name , $conn);

if (!$re) {
    echo 'fail'.$table."\r\n";
echo mysql_errno() . ": " . mysql_error() . "\n";
    exit('connect fail');
}
$rs = mysql_query($sql , $conn);
if (!$rs) {
    echo 'fail'.$table."\r\n";

echo mysql_errno() . ": " . mysql_error() . "\n";
    exit('connect query');
}

$uid = 'asd';
$row = 1;
$i=1;
$c = 0;
while (!empty($row)){
    $i++;
    //if ($i>1000) break;
$row = mysql_fetch_array($rs , MYSQL_ASSOC);
//$re = ml_tool_sendMq::add_atnick_latestAt($row['uid'], $row['follow_uid']);

if ($uid == $row['uid']){
    $c++;
} else {
    $c = 0;
}

if ($c > 9) continue;
$oBizAt->update_latestAt_redis($row['uid'], $row['follow_uid']);
$uid = $row['uid'];

if (!re) {
    $error[]= $row['uid'];
}
};
}
$str = json_encode($error);
file_put_contents('error.log', $str);
